/*
*
*/

#include <stdlib.h>
#include <stdio.h>

#define ds_vram_c
#define LUA_LIB

#include "vars.h"

static int vram_setMainBanks(lua_State *L){
	int a = (int)luaL_checknumber(L, 1);
	int b = (int)luaL_checknumber(L, 2);
	int c = (int)luaL_checknumber(L, 3);
	int d = (int)luaL_checknumber(L, 4);
	lua_pushnumber(L, vramSetMainBanks((VRAM_A_TYPE)a, (VRAM_B_TYPE)b, (VRAM_C_TYPE)c, (VRAM_D_TYPE)d));
	return 1;
}

static int vram_setBankA(lua_State *L){
	int bank = (int)luaL_checknumber(L, 1);
	vramSetBankA(bank);
	return 0;
}

static int vram_default(lua_State *L){
	lua_pushnumber(L, vramDefault());
	return 1;
}

static const luaL_Reg vramlib[] = {
	{"setMainBanks", vram_setMainBanks},
	{"setBankA", vram_setBankA},
	{"default", vram_default},
	{NULL, NULL}
};

/*
** Open infos library
*/
LUALIB_API int luaopen_vram (lua_State *L) {
	luaL_register(L, LUA_VRAMLIBNAME, vramlib);
	return 1;
}

